<?php

class Controller {

    public $tplVariable = array();

    public function assign($name, $value) {
        $this->tplVariable[$name] = $value;
    }

    public function display($tpl, $controllerName) {
        $controller = str_replace('Controller', '', $controllerName);
        $viewPath = "View/{$controller}/{$tpl}.php";
        extract($this->tplVariable);    // 自动注册模版变量
        require_once $viewPath;
    }

}